<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //构造函数实例化对象
    function Phone(brand, price){
      this.brand = brand;
      this.price = price
    }
    Phone.prototype.call = function(){
      console.log("打电话")
    }

    let huawei = new Phone('huawei', 5999)
    huawei.call()
    console.log(huawei)

    //class
    class Shouji{
      constructor(brand, price){
        this.brand = brand;
        this.price = price
      }

      call(){
        console.log('call you later')
      }
    }
    let onePlus = new Shouji('onePlus',1999)
    console.log(onePlus)
  </script>
</body>
</html>